package com.gp.learn.common.core.mybaitsplus.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Administrator
 */
@Slf4j
@Configuration
@MapperScan(value = {"com.gp.learn.**.mapper*"})
public class MybatisPlusConfig {

    /**
     * 分页插件 加载不生效的原因需要在启动类加上扫描包的配置 未注入的话不会有分页效果
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        log.info("mybatis-Plus分页插件注入到容器", paginationInterceptor);
        return paginationInterceptor;
    }

}
